package com.wcs.spring.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.wcs.spring.entity.ClassInfo;

/**
 * <p>
 * Title: Phicomm_[子系统统名]_[模块名]
 * </p>
 * <p>
 * Description: [描述该类概要功能介绍]
 * </p>
 * 
 * @author hexuan2014
 * @version $Revision$ 2015-6-23
 * @author (lastest modification by $Author$)
 * @since 1.0
 */
@Repository(value = "classInfoMapper")
public interface ClassInfoMapper {

	@Select(value = "${sql}")
	List<ClassInfo> queryClassInfoList(@Param(value = "sql") String sql);

	@Insert("insert into classInfo (className,shortName,schoolId,createTime,updateTime,createUser,updateUser,flag) "
			+ "values (#{u.className},#{u.shortName},#{u.schoolId},#{u.createTime},#{u.updateTime},#{u.createUser},#{u.updateUser},0)")
	int addClassInfo(@Param("u") ClassInfo classInfo);

	@Update("UPDATE classInfo SET className=#{u.className}, shortName=#{u.shortName}, "
			+ " updateTime=#{u.updateTime}, updateUser=#{u.updateUser} " + " WHERE id=#{u.id}")
	void updateClassInfo(@Param("u") ClassInfo classInfo);

	@Update("UPDATE classInfo SET flag=1 WHERE id=#{u.id}")
	void delClassInfo(@Param("u") ClassInfo classInfo);

	@Delete("DELETE FROM classInfo WHERE id = #{u.id}")
	void deleteClassInfo(@Param("u") ClassInfo classInfo);

	@Select({ "SELECT * FROM classInfo WHERE id = #{id}" })
	ClassInfo queryClassInfoById(Integer id);
}
